# chromedriver.exe,http://chromedriver.storage.googleapis.com/index.html?path=2.24/
# chrome可以带的参数,https://peter.sh/experiments/chromium-command-line-switches/
#
require 'selenium-webdriver'

Selenium::WebDriver::Chrome.driver_path = '../tools/chromedriver.exe'
options = Selenium::WebDriver::Chrome::Options.new('start-maximized')  # chrome设置选项
driver = Selenium::WebDriver.for :chrome, options: options
driver.manage.timeouts.implicit_wait = 3
driver.navigate.to 'https://10.16.118.54/SPM/index-private.php'

# 下面是登录过程
driver.find_element(name: 'username').send_keys 'admin'
driver.find_element(name: 'password').send_keys 'sangfor123'
driver.find_element(class: 'login-btn').click

# wait = Selenium::WebDriver::Wait.new(timeout: 10) # seconds
list = []
while list.size != 7
  sleep(2)
  list = driver.find_elements(class: 'topMenu-item')
end
sleep(2)
list[2].click


puts('enter...')
gets
driver.quit